package fr.mywiki.business.navigation;

import java.io.Serializable;

/**
 * An object of this type represents a Space variable as it will be used in the
 * jsp pages.
 */
public class SpaceFlyweight implements Serializable {
	private static final long serialVersionUID = 1L;

  /* The standard spaceflyweights */
  public static final SpaceFlyweight WIKI_SPACEFLYWEIGHT = new SpaceFlyweight(
      NavigationManager.WIKI_SPACE, "space.wiki.title", NavigationManager.WIKI_SPACE);
  public static final SpaceFlyweight FILEMANAGEMENT_SPACEFLYWEIGHT = new SpaceFlyweight(
      NavigationManager.FILE_MANAGEMENT_SPACE, "space.files.title",
      NavigationManager.FILE_MANAGEMENT_SPACE);
  public static final SpaceFlyweight MODELSMANAGEMENT_SPACEFLYWEIGHT = new SpaceFlyweight(
      NavigationManager.MODELS_MANAGEMENTS_SPACE, "space.models.title",
      NavigationManager.MODELS_MANAGEMENTS_SPACE);
  public static final SpaceFlyweight ADMINISTRATION_SPACEFLYWEIGHT = new SpaceFlyweight(
      NavigationManager.ADMIN_SPACE, "space.admin.title",
      NavigationManager.ADMIN_SPACE);
  
	/** The key of the title of the space (the way it is displayed on the web page) */
	private String title;
	/** Internal name of the space (the way it is known by the application) */
	private String name;
	/**
	 * Start redirection of this space (which forward must be done to access the
	 * first page of this space)
	 */
	private String startForward;
	
	/**
	 * When being in that space, do we have to display the search tool ? Default
	 * is true.
	 */
	public boolean displaySearch = true;
	
	private SpaceFlyweight() {}

	public SpaceFlyweight(String name, String title, String startForward) {
		setTitle(title);
		setName(name);
		setStartForward(startForward);
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getStartForward() {
		return startForward;
	}

	public void setStartForward(String startForward) {
		this.startForward = startForward;
	}

	public boolean isDisplaySearch() {
		return displaySearch;
	}

	public void setDisplaySearch(boolean displaySearch) {
		this.displaySearch = displaySearch;
	}
}
